<!DOCTYPE html>
<html lang="zh-cn">
    <head><meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'><meta name='description' content='应该是不会有后续了🕊🕊🕊'><title>编译原理学习笔记：文法与语言</title>

<link rel='canonical' href='https://blog.frostmiku.com/archives/20/'>

<link rel="stylesheet" href="/scss/style.min.css"><meta property='og:title' content='编译原理学习笔记：文法与语言'>
<meta property='og:description' content='应该是不会有后续了🕊🕊🕊'>
<meta property='og:url' content='https://blog.frostmiku.com/archives/20/'>
<meta property='og:site_name' content='StarWhisper'>
<meta property='og:type' content='article'><meta property='article:section' content='Post' /><meta property='article:tag' content='编译原理' /><meta property='article:published_time' content='2020-02-21T23:00:00&#43;08:00'/><meta property='article:modified_time' content='2021-06-28T21:22:00&#43;08:00'/><meta property='og:image' content='https://blog.frostmiku.com/archives/20/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg' />
<meta name="twitter:site" content="@iceMiKu">
    <meta name="twitter:creator" content="@iceMiKu"><meta name="twitter:title" content="编译原理学习笔记：文法与语言">
<meta name="twitter:description" content="应该是不会有后续了🕊🕊🕊"><meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:image" content='https://blog.frostmiku.com/archives/20/pawel-czerwinski-8uZPynIu-rQ-unsplash.jpg' />
    <link rel="shortcut icon" href="/favicon.ico" />
<style>
    :root {
        --article-font-family: "Noto Serif SC", var(--base-font-family);
    }
</style>

<script>
		(function () {
		    const customFont = document.createElement('link');
		    customFont.href = "<https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap>";
		
		    customFont.type = "text/css";
		    customFont.rel = "stylesheet";
		
		    document.head.appendChild(customFont);
		}());
</script>
    </head>
    <body class="
    article-page has-toc
">
    <script>
        (function() {
            const colorSchemeKey = 'StackColorScheme';
            if(!localStorage.getItem(colorSchemeKey)){
                localStorage.setItem(colorSchemeKey, "auto");
            }
        })();
    </script><script>
    (function() {
        const colorSchemeKey = 'StackColorScheme';
        const colorSchemeItem = localStorage.getItem(colorSchemeKey);
        const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;

        if (colorSchemeItem == 'dark' || colorSchemeItem === 'auto' && supportDarkMode) {
            

            document.documentElement.dataset.scheme = 'dark';
        } else {
            document.documentElement.dataset.scheme = 'light';
        }
    })();
</script>
<div class="container main-container flex 
    
        extended
    
">
    
        <div id="article-toolbar">
            <a href="https://blog.frostmiku.com" class="back-home">
                <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-chevron-left" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <polyline points="15 6 9 12 15 18" />
</svg>



                <span>Back</span>
            </a>
        </div>
    
<main class="main full-width">
    <article class="has-image main-article">
    <header class="article-header">
        <div class="article-image">
            <a href="/archives/20/">
                <img src="/archives/20/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_800x0_resize_q75_box.jpg"
                        srcset="/archives/20/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_800x0_resize_q75_box.jpg 800w, /archives/20/pawel-czerwinski-8uZPynIu-rQ-unsplash_hud7e36f7e20e71be184458283bdae4646_55974_1600x0_resize_q75_box.jpg 1600w"
                        width="800" 
                        height="534" 
                        loading="lazy"
                        alt="Featured image of post 编译原理学习笔记：文法与语言" />
                
            </a>
        </div>
    

    <div class="article-details">
    
    <header class="article-category">
        
            <a href="/categories/%E7%AC%94%E8%AE%B0/" style="background-color: #2a9d8f; color: #fff;">
                笔记
            </a>
        
            <a href="/categories/%E6%95%B4%E6%B4%BB/" style="background-color: #ff945f; color: #fff;">
                整活
            </a>
        
    </header>
    

    <h2 class="article-title">
        <a href="/archives/20/">编译原理学习笔记：文法与语言</a>
    </h2>

    
    <h3 class="article-subtitle">
        应该是不会有后续了🕊🕊🕊
    </h3>
    <footer class="article-time">
        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <circle cx="12" cy="12" r="9" />
  <polyline points="12 7 12 12 15 15" />
</svg>



        <time class="article-time--published">Feb 21, 2020</time>
    </footer></div>
</header>

    <section class="article-content">
    <h2 id="前言">前言</h2>
<p>本学期开了编译原理课，嗯写作本文的原因就这么简单&hellip;</p>
<h2 id="基本概念">基本概念</h2>
<ul>
<li>字母表：非空有限集，一般用$∑$表示，如$∑＝{a,b,c}$</li>
<li>符号： $∑$中的元素称为符号。</li>
<li>符号串：符号的有穷序列称符号串，也可称为字，用ε表示空字符串。</li>
<li>长度：符号串中包括的符号的个数，如$|ab|＝2,|ε|＝0$</li>
<li>连接：设x和y是字符串，则称$x·y$是其连接，符号‘·’一般可省略。
对于任意字符串$β$，有$βε＝εβ＝β$</li>
<li>乘积：设A和B是符号串集，则用AB表示它们的乘积：</li>
</ul>
<p>$$
AB＝{xy|x∈A,y∈B }
$$</p>
<p>显然${ε}A=A{ε}=A$</p>
<ul>
<li>空集：不含任何元素的集合φ，对任何字符串集A有：</li>
</ul>
<p>$$
φA＝Aφ＝A
$$</p>
<ul>
<li>方幂：设A是字符串集，则A的方幂定义为：</li>
</ul>
<p>$$
A^0 ={ε};
A^1 ＝A;
A^n ＝A^{n-1} A
$$</p>
<p>特别地，若x是$∑$中的字符，则x的n次自身连接即$x^n$</p>
<ul>
<li>闭包/正闭包/星闭包：设A是符号集，
用$A^+$表示A的正闭包:</li>
</ul>
<p>$$
A^+=A^1∪A^2∪\dots∪A^n∪\dots
$$</p>
<p>用$A^*$表示A的星闭包:</p>
<p>$$
A^*＝A^0∪A^1∪A^2∪\dots∪A^n∪\dots={ε}∪A^+
$$</p>
<p>两者统称为A的闭包。</p>
<p>举个例子<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup>：
设$A = {a,b}$ 则：</p>
<p>$$
\begin{aligned}
&amp;A^0 ＝ {ε}\cr
&amp;A^1 = {a,b}\cr
&amp;A^2 = AA = {aa,ab,ba,bb}\cr
&amp;A^3 = AAA = {aaa,aab,aba,abb,baa,bab,bba,bbb}\cr
&amp;\dots\cr
\end{aligned}
$$</p>
<h3 id="符号和符号串">符号和符号串</h3>
<p>任何程序设计语言都是某一基本符号集上的字符序列，其中的字符用来构造单词，单词构造更大的语法单位，表达式、语句等复合对象。其中，<strong>单词是最小的语义单位</strong>,它不包含任何子结构，因此每个单词是简单的字符序列。</p>
<h2 id="语言">语言</h2>
<p>程序设计语言是一个<strong>记号系统</strong>，同自然语言一样，完整的定义应包括<strong>语法</strong>和<strong>语义</strong>两个方面。</p>
<p>语言的语法是指<strong>一组规则</strong>，用它可以形成和产生一个合适的程序。语法规定了特定符号序列的合法性，而与符号的含义没有关系。任何程序设计语言都是某一基本符号集上的字符序列。</p>
<p>对于语义的分析与处理到目前为止仍然没有公认的形式系统用于自动构造正确的编译程序。</p>
<h3 id="形式语言">形式语言</h3>
<p>形式语言（英语：Formal language）是用精确的数学或机器可处理的公式定义的语言。在形式语言理论中，形式语言是一个字母表上的某些有限长字符串的<strong>集合</strong>。</p>
<p>每个形式语言都是某个字母表上按某种规则构成的所有符号的集合，反之，任何一个字母表上符号串的集合均可定义为一个形式语言，不涉及考虑语义问题。</p>
<h4 id="语言间的运算">语言间的运算</h4>
<p>因为形式语言在本质上是由数学定义的的集合，所以语言间的运算就是$Σ^*$幂集上的运算。与普通的集合数学运算无异。</p>
<h3 id="语言的表示方法">语言的表示方法</h3>
<p>从形式语言的角度看，一个语言也就是字符串集。如果字符串集是有穷的，可以用枚举的办法表示出来。
例如，设有字母表 $A={a,b,c}$，则</p>
<p>$$
\begin{aligned}
&amp;L_1 = {a,b,c}\cr
&amp;L_2 = {a,aa,ab,ac}\cr
&amp;L_3 = {c,cc}
\end{aligned}
$$</p>
<p>均表示字母表A上的一个形式语言。</p>
<p>当集合无穷时，<del>我们可以使用无限猴子定理</del>枚举的办法就不行了，需要寻找合适的有穷表示方法——<strong>文法</strong>。</p>
<p>除形式文法外，语言也可使用正则表达式或某些自动机表示，在本章暂不讨论。</p>
<h2 id="文法">文法</h2>
<p>在形式语言理论中，文法（为了避免歧义，常称作“形式文法”）是形式语言中字符串的一套产生式规则。这些规则描述了如何用语言的字母表生成符合语法的有效的字符串。文法不描述字符串的含义，也不描述在任何上下文中可以用它们做什么——只描述它们的形式。
形式文法是从一个“开始符号”出发的一套重写字符串的规则。因此，文法通常被认为是语言生成器。<sup id="fnref:2"><a href="#fn:2" class="footnote-ref" role="doc-noteref">2</a></sup></p>
<p>ps: 形式语言理论是应用数学的一个分支，是研究形式文法和语言的学科。</p>
<h3 id="规则">规则</h3>
<p>我们以汉语句子的文法为例：</p>
<pre tabindex="0"><code>句子 → 主语·谓语

主语 → 代词∣名词

代词 → 我∣你∣他

名词 → 司机∣农民∣学生∣汽车∣锄头

谓语 → 动词·直接宾语

动词 → 学习∣拿起∣开

直接宾语 → 代词∣名词
</code></pre><p>其上的每一条被称为<strong>产生式</strong>或<strong>语法规则</strong>，符号“→”也可以写成“∷=”，表示“被定义为”。</p>
<p>符号“·”和“∣”是集合运算符号，“·”表示“连接”，该符号往往被省略，“∣”表示“或”，该符号两边的符号串称候选串。</p>
<p>由上面的规则可以<strong>产生或推导出句子</strong>，引进符号“=&gt;”表示推导，比如句子“农民拿起锄头”的推导过程为：句子=&gt;主语·谓语=&gt;名词·谓语=&gt;农民·谓语=&gt;农民·动词·直接宾语=&gt;农民·拿起·直接宾语=&gt;农民·拿起·名词=&gt;农民拿起锄头</p>
<h2 id="形式定义">形式定义</h2>
<p>接下来我们以数学为工具，利用符号和公式，精确地定义文法和语言。</p>
<h3 id="文法的形式定义">文法的形式定义</h3>
<p>文法是规则的<strong>非空</strong>有穷集合。其形式定义为四元组$G[S]=(V_N,V_T,P,S)$</p>
<ul>
<li>$V_N$是规则中非终结符号的集合。</li>
<li>$V_T$是规则中终结符号的集合，显然文法在这里结束。</li>
<li>P是文法规则的合集。</li>
<li>S是一个非终结符号，显然文法从这里开始。</li>
</ul>
<h3 id="语言的形式定义">语言的形式定义</h3>
<p>当一个文法已知时，我们可以确定出该文法所定义的语言，但在此之前我们需要先弄明白什么是句子，这里我们需要引入推导的概念。</p>
<h4 id="推导">推导</h4>
<p>如果存在一个直接推导序列</p>
<p>$$
a_0 \Rightarrow a_1 \Rightarrow a_2 \Rightarrow \dots \Rightarrow a_n
$$</p>
<p>则称这个序列是$a_0$到$a_n$的长度为n的推导，记为$a_0\stackrel{+}{\Rightarrow}a_n$。</p>
<p>表示从$a_0$出发，经过1到n步可以推导出$a_n$。</p>
<h4 id="广义推导">广义推导</h4>
<p>广义推导的符号为$\stackrel{*}{\Rightarrow}$</p>
<p>$a_0 \stackrel{*}{\Rightarrow} a_n$表示从$a_0$出发，经过0到n步可以推导出$a_n$。</p>
<h4 id="句型与句子">句型与句子</h4>
<p>对于文法 $G[S]$，如果</p>
<p>$$
S \stackrel{*}{\Rightarrow} x
$$</p>
<p>称符号串x为文法 $G[S]$ 的句型。</p>
<p>$$
S \stackrel{*}{\Rightarrow}x, x∈V_T^*
$$</p>
<p>则称符号串x是文法$G[S]$的句子。</p>
<hr>
<p>有了以上概念后，我们可以给出语言的形式定义：</p>
<p>文法 $G[S]$ 产生的所有句子的集合称为文法G所定义的语言，记为$L(G[S])$</p>
<p>$$
L(G[S])={x|S\stackrel{+}{\Rightarrow}x,x∈V_T^*}
$$</p>
<h2 id="reference">Reference</h2>
<section class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1" role="doc-endnote">
<p>编译原理 刘铭、徐兰芳等｜电子工业出版社&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
<li id="fn:2" role="doc-endnote">
<p>维基百科 <a class="link" href="https://zh.wikipedia.org/wiki/%e5%bd%a2%e5%bc%8f%e6%96%87%e6%b3%95"  target="_blank" rel="noopener"
    >形式文法</a>&#160;<a href="#fnref:2" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</section>

</section>


    <footer class="article-footer">
    
    <section class="article-tags">
        
            <a href="/tags/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86/">编译原理</a>
        
    </section>


    
    <section class="article-copyright">
        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copyright" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <circle cx="12" cy="12" r="9" />
  <path d="M14.5 9a3.5 4 0 1 0 0 6" />
</svg>



        <span>Licensed under CC BY-NC-SA 4.0</span>
    </section>
    <section class="article-time">
        <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <circle cx="12" cy="12" r="9" />
  <polyline points="12 7 12 12 15 15" />
</svg>



        <span class="article-time--modified">
            最后更新于 Jun 28, 2021 21:22 CST
        </span>
    </section></footer>

    
        <link 
                rel="stylesheet" 
                href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css"integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3&#43;Aro6EYUG4&#43;cU&#43;KJWu/X"crossorigin="anonymous"
            ><script 
                src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js"integrity="sha384-g7c&#43;Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI&#43;sEnkvrMWph2EDg4"crossorigin="anonymous"
                defer="true"
                >
            </script><script 
                src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js"integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC&#43;Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa"crossorigin="anonymous"
                defer="true"
                >
            </script><script>
    window.addEventListener("DOMContentLoaded", () => {
        renderMathInElement(document.querySelector(`.article-content`), {
            delimiters: [
                { left: "$$", right: "$$", display: true },
                { left: "$", right: "$", display: false },
                { left: "\\(", right: "\\)", display: false },
                { left: "\\[", right: "\\]", display: true }
            ],
        });})
</script>
    
</article>

    <aside class="related-contents--wrapper">
    
    
        <h2 class="section-title">相关文章</h2>
        <div class="related-contents">
            <div class="flex article-list--tile">
                
                    
<article class="has-image">
    <a href="/archives/28/">
        
        
            <div class="article-image">
                <img src="/archives/28/bigsur.fe3a06fb4c083872772aa8c30a0fad85_hu1882b8a1356b3be9e2c65bea0519cb32_1306396_250x150_fill_box_smart1_3.png" 
                        width="250" 
                        height="150" 
                        loading="lazy" 
                        data-key="28" 
                        data-hash="md5-/joG&#43;0wIOHJ3KqjDCg&#43;thQ==">
                
            </div>
        

        <div class="article-details">
            <h2 class="article-title">OpenCore打造一个完美的 Hackintosh 遇到的问题</h2>
        </div>
    </a>
</article>
                
                    
<article class="has-image">
    <a href="/archives/42/">
        
        
            <div class="article-image">
                <img src="/archives/42/title.bc790643d2285de04d505b9396c1bcb9_hu8b78c802ef23d72a1f175f8afba741c2_9707_250x150_fill_q75_box_smart1.jpg" 
                        width="250" 
                        height="150" 
                        loading="lazy" 
                        data-key="42" 
                        data-hash="md5-vHkGQ9IoXeBNUFuTlsG8uQ==">
                
            </div>
        

        <div class="article-details">
            <h2 class="article-title">使 macOS 的光标像 windows 一样移动</h2>
        </div>
    </a>
</article>
                
                    
<article class="">
    <a href="/archives/38/">
        
        

        <div class="article-details">
            <h2 class="article-title">玄学BUG（一）</h2>
        </div>
    </a>
</article>
                
                    
<article class="has-image">
    <a href="/archives/36/">
        
        
            <div class="article-image">
                <img src="/archives/36/3.db9678b38accfdebd5aecc5a766b9a27_hu5f6040234dc4fded8a5d093800e3042d_106071_250x150_fill_q75_box_smart1.jpg" 
                        width="250" 
                        height="150" 
                        loading="lazy" 
                        data-key="36" 
                        data-hash="md5-25Z4s4rM/evVrsxadmuaJw==">
                
            </div>
        

        <div class="article-details">
            <h2 class="article-title">基于肢体运动的睡眠状态检测原理</h2>
        </div>
    </a>
</article>
                
                    
<article class="has-image">
    <a href="/archives/35/">
        
        
            <div class="article-image">
                <img src="/archives/35/after.945f6b0283370c0e5d12f832f1319bc9_hu23b7e7c62fd8951b5b31d4f97802b41e_155221_250x150_fill_q75_box_smart1.jpg" 
                        width="250" 
                        height="150" 
                        loading="lazy" 
                        data-key="35" 
                        data-hash="md5-lF9rAoM3DA5dEvgy8TGbyQ==">
                
            </div>
        

        <div class="article-details">
            <h2 class="article-title">仿手写文本生成</h2>
        </div>
    </a>
</article>
                
            </div>
        </div>
    
</aside>

     
     
        
    <script src="https://utteranc.es/client.js" 
        repo="FrostMiKu/frostmiku.github.io"
        issue-term="title"
        
        label="Comment"
        
        crossorigin="anonymous"
        async
        >
</script>

<style>
    .utterances {
        max-width: unset;
    }
</style>

<script>
    function setUtterancesTheme(theme) {
        let utterances = document.querySelector('.utterances iframe');
        if (utterances) {
            utterances.contentWindow.postMessage(
                {
                    type: 'set-theme',
                    theme: `github-${theme}`
                },
                'https://utteranc.es'
            );
        }
    }

    addEventListener('message', event => {
        if (event.origin !== 'https://utteranc.es') return;
        setUtterancesTheme(document.documentElement.dataset.scheme)
    });

    window.addEventListener('onColorSchemeChange', (e) => {
        setUtterancesTheme(e.detail)
    })
</script>


    

    <footer class="site-footer">
    <section class="copyright">
        &copy; 
        
            2014 - 
        
        2022 StarWhisper
    </section>
    
    <section class="powerby">
        
            FrostMiKu <br/>
        Built with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a> <br />
        Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="2.4.0">Stack</a></b> designed by <a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>
        <br />
        <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
        <span id="busuanzi_container_site_pv">本站总访问量 <span id="busuanzi_value_site_pv"></span> 次</span>
    </section>
</footer>

    
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    
    <div class="pswp__bg"></div>

    
    <div class="pswp__scroll-wrap">

        
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                
                
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div><script 
                src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"integrity="sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo="crossorigin="anonymous"
                defer="true"
                >
            </script><script 
                src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"integrity="sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU="crossorigin="anonymous"
                defer="true"
                >
            </script><link 
                rel="stylesheet" 
                href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css"integrity="sha256-c0uckgykQ9v5k&#43;IqViZOZKc47Jn7KQil4/MP3ySA3F8="crossorigin="anonymous"
            ><link 
                rel="stylesheet" 
                href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.css"integrity="sha256-SBLU4vv6CA6lHsZ1XyTdhyjJxCjPif/TRkjnsyGAGnE="crossorigin="anonymous"
            >

            </main>
    
        <aside class="sidebar right-sidebar sticky">
            <section class="widget archives">
                <div class="widget-icon">
                    <svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  <path stroke="none" d="M0 0h24v24H0z"/>
  <line x1="5" y1="9" x2="19" y2="9" />
  <line x1="5" y1="15" x2="19" y2="15" />
  <line x1="11" y1="4" x2="7" y2="20" />
  <line x1="17" y1="4" x2="13" y2="20" />
</svg>



                </div>
                <h2 class="widget-title section-title">Table of contents</h2>
                
                <div class="widget--toc">
                    <nav id="TableOfContents">
  <ol>
    <li><a href="#前言">前言</a></li>
    <li><a href="#基本概念">基本概念</a>
      <ol>
        <li><a href="#符号和符号串">符号和符号串</a></li>
      </ol>
    </li>
    <li><a href="#语言">语言</a>
      <ol>
        <li><a href="#形式语言">形式语言</a>
          <ol>
            <li><a href="#语言间的运算">语言间的运算</a></li>
          </ol>
        </li>
        <li><a href="#语言的表示方法">语言的表示方法</a></li>
      </ol>
    </li>
    <li><a href="#文法">文法</a>
      <ol>
        <li><a href="#规则">规则</a></li>
      </ol>
    </li>
    <li><a href="#形式定义">形式定义</a>
      <ol>
        <li><a href="#文法的形式定义">文法的形式定义</a></li>
        <li><a href="#语言的形式定义">语言的形式定义</a>
          <ol>
            <li><a href="#推导">推导</a></li>
            <li><a href="#广义推导">广义推导</a></li>
            <li><a href="#句型与句子">句型与句子</a></li>
          </ol>
        </li>
      </ol>
    </li>
    <li><a href="#reference">Reference</a></li>
  </ol>
</nav>
                </div>
            </section>
        </aside>
    

        </div>
        <script 
                src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.5/dist/vibrant.min.js"integrity="sha256-5NovOZc4iwiAWTYIFiIM7DxKUXKWvpVEuMEPLzcm5/g="crossorigin="anonymous"
                defer="false"
                >
            </script><script type="text/javascript" src="/ts/main.js" defer></script>
<script>
    (function () {
        const customFont = document.createElement('link');
        customFont.href = "https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap";

        customFont.type = "text/css";
        customFont.rel = "stylesheet";

        document.head.appendChild(customFont);
    }());
</script>

    </body>
</html>
